#!/bin/sh
freeswap=`/usr/local/nagios/libexec/check_nrpe -H $1 -c check_swap|awk -F '(' '{print $2}'|awk -F ')' '{print $1}'|awk -F ' out of ' '{print $1}'|awk -F' ' '{print $1}'`
totalswap=`/usr/local/nagios/libexec/check_nrpe -H $1 -c check_swap|awk -F '(' '{print $2}'|awk -F ')' '{print $1}'|awk -F ' out of ' '{print $2}'|awk -F' ' '{print $1}'`

usedmem=`/usr/local/nagios/libexec/check_nrpe -H $1 -c check_mem |grep ^'|' | awk -F"|"  '{print $2}'|awk -F"=" '{print $2}'|awk -F";" '{print $1}'|awk -F"Mb" '{print $1}'`
totalmem=`/usr/local/nagios/libexec/check_nrpe -H $1 -c check_mem | awk -F"|"  '{print $1}' | awk -F '(' '{print $2}'| awk -F ')' '{print $1}'|awk -F ' KB out of ' '{print $2}'|awk -F ' KB' '{print $1}'`

#totalm=`expr "scale=2; $totalmem/1024"|bc`
#totalm=`expr " $totalmem/1024"|bc`

echo "freeswap:"$freeswap" totalswap:"$totalswap" allocatedmem:"$usedmem" totalmem:"$totalmem" "
